﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Medicare
{
    public partial class FrmMain : Form
    {
        public FrmMain()
        {
            InitializeComponent();
        }

        //下载数据功能
        private void btnDownLoad_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //FrmItemRelationYP f2 = new  FrmItemRelationYP();
            FrmDownLoadData f2 = new FrmDownLoadData();
            f2.TopLevel = false;    //设置为非顶级窗体
            f2.FormBorderStyle = FormBorderStyle.None;       //设置窗体为非边框样式
            //f2.Dock = System.Windows.Forms.DockStyle.Fill;   //设置样式是否填充整个PANEL
            lyControlCenter.Controls.Add(f2);      //添加窗体
            f2.Dock = lyControlCenter.Dock;//System.Windows.Forms.DockStyle.Fill;   //设置样式是否填充整个PANEL
            //lyControlCenter.Dock
            f2.Show();   
        }

        private void lyControlCenter_Resize(object sender, EventArgs e)
        {

        }

        private void btnInhosRegist_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            FrmInhosRegister frmInhos = new FrmInhosRegister();
            frmInhos.TopLevel = false;
            frmInhos.FormBorderStyle = FormBorderStyle.None;
            lyControlCenter.Controls.Add(frmInhos);
            frmInhos.Dock = lyControlCenter.Dock;
            frmInhos.Show();

        }

        private void ClearForControlCenter()
        {
            lyControlCenter.Controls.Clear();
            lyControlCenter.Controls.Add(pictureEdit1);
        }

        private void btnRelationJZ_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            FrmItemRelationZL frmInhos = new FrmItemRelationZL();
            frmInhos.TopLevel = false;
            frmInhos.FormBorderStyle = FormBorderStyle.None;
            lyControlCenter.Controls.Add(frmInhos);
            frmInhos.Dock = lyControlCenter.Dock;
            frmInhos.Show();
        }

        private void btnRelationYP_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            FrmItemRelationYP frmInhos = new  FrmItemRelationYP();
            frmInhos.TopLevel = false;
            frmInhos.FormBorderStyle = FormBorderStyle.None;
            lyControlCenter.Controls.Add(frmInhos);
            frmInhos.Dock = lyControlCenter.Dock;
            frmInhos.Show();

 
        }

        private void btnPreCalc_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            FrmUpLoadChargeItem frmInhos = new FrmUpLoadChargeItem();
            frmInhos.TopLevel = false;
            frmInhos.FormBorderStyle = FormBorderStyle.None;
            lyControlCenter.Controls.Add(frmInhos);
            frmInhos.Dock = lyControlCenter.Dock;
            frmInhos.Show();
        }

        private void btnQueryCalcData_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            FrmBalanceInfoDetail frmInhos = new FrmBalanceInfoDetail();
            frmInhos.TopLevel = false;
            frmInhos.FormBorderStyle = FormBorderStyle.None;
            lyControlCenter.Controls.Add(frmInhos);
            frmInhos.Dock = lyControlCenter.Dock;
            frmInhos.Show();
        }

        /// <summary>
        /// 注册
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnRegist_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //FrmRegist frmInhos = new FrmRegist();
            //frmInhos.TopLevel = false;
            //frmInhos.FormBorderStyle = FormBorderStyle.None;
            //lyControlCenter.Controls.Add(frmInhos);
            //frmInhos.Dock = lyControlCenter.Dock;
            //frmInhos.Show();
        }


        //费用明细上报
        private void btnCheckCharge_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {

            FrmMedicareCheckItem frmInhos = new FrmMedicareCheckItem();
            frmInhos.TopLevel = false;
            frmInhos.FormBorderStyle = FormBorderStyle.None;
            lyControlCenter.Controls.Add(frmInhos);
            frmInhos.Dock = lyControlCenter.Dock;
            frmInhos.Show();
        }

        private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (MessageBox.Show("您确定要退出程序吗？", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                e.Cancel = true;
            }
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            barStaticItem2.Caption = "当前时间："+DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
        }

        private void FrmMain_Load(object sender, EventArgs e)
        {
            barStaticItem5.Caption = ToolUltity.LoginUser.USERID;
            barStaticItem6.Caption = ToolUltity.LoginUser.USERNAME;
        }

        private void btnChangePwd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            FrmLoginUser frmInhos = new FrmLoginUser();
            //frmInhos.TopLevel = false;
            //frmInhos.FormBorderStyle = FormBorderStyle.None;
            //lyControlCenter.Controls.Add(frmInhos);
            //frmInhos.Dock = lyControlCenter.Dock;
            frmInhos.textBox5.Text = ToolUltity.LoginUser.USERID;
            frmInhos.textBox5.Enabled = false;
            frmInhos.textBox4.Text = ToolUltity.LoginUser.USERNAME;
            frmInhos.Name = "修改密码";
            frmInhos.ShowDialog();
            

        }

        private void btnAddUser_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            FrmLoginUser frmInhos = new FrmLoginUser();
            //frmInhos.TopLevel = false;
            //frmInhos.FormBorderStyle = FormBorderStyle.None;
            //lyControlCenter.Controls.Add(frmInhos);
            //frmInhos.Dock = lyControlCenter.Dock;
            //frmInhos.Show();
            frmInhos.ShowDialog();
        }

        private void btnChangeUser_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {

        }

        private void btnQuit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            this.Close();
        }

        private void btnAbout_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            AboutBox frmInhos = new AboutBox();
            frmInhos.ShowDialog();
        }


        /*
         * FrmLoginUser f = new FrmLoginUser();
            f.Name = "新增操作员";
            f.textBox5.Text = LoginUser.USERID;
            f.textBox5.Enabled = false;
            f.textBox4.Text = LoginUser.USERNAME;

            f.ShowDialog();
         */

        ////Form2窗体随Form1大小的改变而改变

        //private void panel1_Resize(object sender, System.EventArgs e)
        //{
        //    try
        //    {
        //        this.f2.ClientSize = new System.Drawing.Size(panel1.Size.Width, panel1.Size.Height);
        //    }
        //    catch (System.Exception er)
        //    {
        //        MessageBox.show(er.ToString());
        //    }
        //}




    }
}
